<template>
  <el-container>
    <el-main>
      <el-form ref="formRef" :model="form.model" :rules="rules" label-width="100">
        <el-form-item label="充值金额" prop="money">
          <el-input v-model="form.model.money" type="number" placeholder="为负数则为扣除" />
        </el-form-item>
        <el-form-item label="备注">
          <el-input v-model="form.model.remark" type="textarea" placeholder="请输入备注" />
        </el-form-item>
      </el-form>
    </el-main>
    <el-footer class="sa-footer--submit">
      <el-button @click="back">返回</el-button>
      <el-button type="primary" @click="confirm">确定</el-button>
    </el-footer>
  </el-container>
</template>
<script setup>
  import { reactive, ref, unref, computed } from 'vue';
  import { api } from './business.service';


  const emit = defineEmits(['modalCallBack']);
  const props = defineProps(['modal']);

  const formRef = ref();
  const form = reactive({
    model: {
      money: '1',
      remark: '',
    },
  });

  const rules = reactive({
    money: [
      { required: true, message: '请输入充值金额', trigger: 'blur' },
    ],
  });

  const back = () => {
    emit('modalCallBack', { event: 'back' });
  };

  const confirm = () => {
    unref(formRef).validate(async (valid) => {
      if (!valid) return;
    });
  };
</script>
